<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jstl/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:converge="http://com.interactivemediamanagement.converge/tags">

    <c:if test="#{value.currentActor &amp;&amp; !value.readOnly}">

        <converge:moduleHeader moduleTitle="#{msgs.newsitem_OPTIONS}" />
        <div>
            <h:panelGrid id="pgWorkflowOptions" style="margin-left: 2%; margin-right: 2%; width: 98%" rowClasses="left, left,center, center">

                <h:outputText value="#{msgs.newsitem_WORKFLOW_SELECT_INTRO}" style="font-size: 9px;" />

                <h:selectOneRadio style="margin-top: 5px;" layout="pageDirection" value="#{value.selectedStep}" converter="#{converters.workflowStepConverter}">
                    <f:selectItems value="#{value.availableWorkflowSteps}" />
                    <a4j:support event="onclick" reRender="btnSubmit, pgWorkflowComment" actionListener="#{value.onValidateWorkflowStep}" />
                </h:selectOneRadio>

                <h:panelGrid id="pgWorkflowComment">
                    <h:panelGrid rendered="#{value.validWorkflowStep}">
                        <h:outputText value="Enter a message for the next actor" />
                        <h:inputTextarea id="txtWorkflowComment" value="#{value.comment}" style="width: 100%; height: 40px;" styleClass="text"  />
                    </h:panelGrid>
                </h:panelGrid>

                <h:column>
                    <h:commandButton id="btnSubmit" value="#{msgs.SUBMIT}" action="#{value.onSubmit}" disabled="#{!value.validWorkflowStep}" styleClass="button #{(!newsItem.validWorkflowStep || !(converge:isAllValid())) ? 'disabledButton' : ''}" style="margin-top: 8px; padding-left: 5px; padding-right: 5px; width: 60px;" />
                    <a4j:commandButton id="btnSave" value="#{msgs.SAVE}" actionListener="#{value.onApply}" styleClass="button" style="margin-top: 8px; margin-left: 5px; padding-left: 5px; padding-right: 5px; width: 60px;" />
                    <h:commandButton id="btnClose" value="#{msgs.CLOSE}" action="#{value.onClose}" immediate="true" styleClass="button" style="margin-top: 8px; margin-left: 5px; padding-left: 5px; padding-right: 5px; width: 60px;" />
                </h:column>

            </h:panelGrid>
        </div>

        <div style="clear: both; padding-bottom: 12px;"></div>
    </c:if>

    <c:if test="#{!value.editable &amp;&amp; value.pullbackAvailable}">

        <converge:moduleHeader moduleTitle="#{msgs.newsitem_OPTIONS}" />
        <div>
            <h:panelGrid id="pgWorkflowPullback" style="margin-left: 2%; margin-right: 2%; width: 98%" rowClasses="left, center">
                    <h:outputText value="#{msgs.newsitem_PULLBACK_INTRO}" style="font-size: 9px;" />
                    <h:commandButton id="btnPullback" value="#{msgs.newsitem_PULLBACK}" onclick="if (confirm('#{msgs.newsitem_PULLBACK_CONFIRM}') != true){ return false; };" actionListener="#{value.onPullback}" styleClass="button dynamicButton"  />
            </h:panelGrid>
        </div>

        <div style="clear: both; padding-bottom: 12px;"></div>
    </c:if>

</ui:composition>
